home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
mint
/
shells
/
bashsrc.zoo
/
features
< prev
next >
Wrap
Text File
|
1991-05-29
|
21KB
|
654 lines
-*- text -*-
This isn't real documentation, but we have to tell people how this shell is
different from others.
NEW STUFF SINCE LAST RELEASE:
history_control variable.
Set to a value of "ignorespace", it means don't enter lines which begin
with a SPC on the history list.
Set to a value of "ignoredups", it means don't enter lines which match
the last entered line.
Unset, or any other value than those above mean to save all lines read
by the parser on the history list.
END OF NEW STUFF
When and how bash executes login, rc, and logout files.
Login shells:
On login:
if /etc/profile exists, source it.
if ~/.bash_profile exists, source it,
else if ~/.bash_login exists, source it,
else if ~/.profile exists, source it.
On logout:
if ~/.bash_logout exists, source it.
Non-login interactive shells:
On startup:
if ~/.bashrc exists, source it.
Non-interactive shells:
On startup:
if the environment variable "ENV" is non-null, source the file
mentioned there.
So, typically, your ~/.bash_profile file contains the line
if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
after (or before) any login specific initializations.
You can tell if a shell is interactive or not from within your ~/.bashrc
file by examining $PS1; it is unset in non-interactive shells, and set in
interactive shells. Thus:
if [ "$PS1" = "" ]; then
echo This shell is not interactive
else
echo This shell is interactive
fi
You can ask an interactive bash to not run your .bashrc file, with the
-norc flag. You can change the name of the .bashrc file to any other
file with -rcfile FILENAME. You can ask bash to not run your
.bash_profile file with -noprofile.
alias: alias [ name [=value] ...]
Alias with no arguments prints the list of aliases in the form
name=value on standard output. An alias is defined for each NAME
whose VALUE is given. A trailing space in VALUE causes the next
word to be checked for alias substitution. Alias returns true
unless a NAME is given for which no alias has been defined.
unalias: unalias [name ...]
Remove NAMEs from the list of defined aliases.
exec: exec [ [-] file [redirections]]
Exec FILE, replacing this shell with the specified program.
If FILE is not specified, the redirections take effect in this
shell. If the first argument is `-', then place a dash in the
zeroith arg passed to FILE. This is what login does. If the file
cannot be exec'ed for some reason, the shell exits, unless the
shell variable "no_exit_on_failed_exec" exists.
help: help [pattern]
Display helpful information about builtin commands. If
PATTERN is specified, gives detailed help on all commands
matching PATTERN, otherwise a list of the builtins is
printed.
enable: enable [-n name ...]
Enable and disable builtin shell commands. This allows
you to use a disk command which has the same name as a shell
builtin. If -n is used, the NAMEs become disabled. Otherwise
NAMEs are enabled. For example, to use /bin/test instead of the
shell builtin version, you would type `enable -n test'.
pushd: pushd [dir | +n]
Save the current directory on a list and then CD to DIR.
With no arguments, exchanges the top two directories.
+n Brings the Nth directory to the top of the list by rotating.
dir Makes the current working directory be the top of
the stack, and then cd's to DIR.
You can see the saved directory list with the `dirs' command.
popd: popd [+n]
Pops the directory stack, and cd's to the new top directory.
The elements are numbered from 0 starting at the first directory
listed with `dirs'; i.e. `popd' is equivalent to `popd 0'.
history: history [n] [ [-w -r] [filename]]
Display the history list with line numbers. Lines listed with
with a `*' have been modified. Argument of N says to list only
the last N lines. Argument `-w' means write out the current
history file. `-r' means to read it instead. If FILENAME is
given, then use that file, else if $HISTFILE has a value, use
that, else use ~/.bash_history.
********************
NEW Ulimit Implementation
ulimit: ulimit [-cdmstf [limit]]
Ulimit provides control over the resources available to processes
started by the shell, on systems that allow such control. If an
option is given, it is interpreted as follows:
-c the maximum size of core files created
-d the maximum size of a process's data segment
-m the maximum resident set size
-s the maximum stack size
-t the maximum amount of cpu time in milliseconds
-f the maximum size of files created by
If limit is given, it is multiplied by a constant factor (a block
size, currently 512) and the result becomes the new value of the
specified resource. If limit is not given, the current value of
the specified resource is printed. If no option is given, then the
maximum allowable size of a file created by the shell or any of its
children is printed (equivalent to the -f option).
********************
Tilde expansion:
This shell does tilde expansion:
~ = $HOME
~/foo = $HOME/foo
~fred/foo = (fred's home directory)/foo
~+/foo = $PWD/foo
~-/foo = $OLDPWD/foo
We have functions. You can say:
foo () { ls $1 ; }
or
function foo () { ls $1 ; }
Here is the comment next to the decode_prompt_string function.
/* Return a string which will be printed as a prompt. The string
may contain special characters which are decoded as follows:
\t the time
\d the date
\n CRLF
\s the name of the shell
\w the current working directory
\u your username
\h the hostname
\# the command number of this command
\! the history number of this command
\<octal> character code in octal
\\ a backslash
*/
Here is the comment next to the check_mail function, which is called
periodically. See the documentation for ksh MAILCHECK MAILPATH, etc.
We also have MAIL_WARNING, see below.
/* check_mail () is useful for more than just checking mail. Since it has
the paranoids dream ability of telling you when someone has read your
mail, it can just as easily be used to tell you when someones .profile
file has been read, thus letting one know when someone else has logged
in. Pretty good, huh? */
/* Check for mail in some files. If the modification date of any
of the files in MAILPATH has changed since we last did a
remember_mail_dates () then mention that the user has mail.
Special hack: If the shell variable MAIL_WARNING is on and the
mail file has been accessed since the last time we remembered, then
the message "The mail in <mailfile> has been read" is printed. */
READLINE:
This is the library that handles reading input when using an interactive
shell. The line editing commands are similar to emacs' line editing commands.
You may change the default key-bindings with a ~/.inputrc file. Various
programs that use this library may add their own commands and bindings.
If you wanted to make M-C-u do universal-argument, then in your ~/.inputrc file
you would put:
M-Control-u: universal-argument
or
C-Meta-u: universal-argument
You can use the following names for characters: RUBOUT, DEL, ESC,
NEWLINE, SPACE, RETURN, LFD, TAB
You can start with a vi-like editing mode by placing
set editing-mode vi
in your ~/.inputrc file.
You can have readline use a single line for display, scrolling the input
between the two borders by placing
set horizontal-scroll-mode On
in your ~/.inputrc file.
The following is a list of the names of the commands and the default
key-strokes to get them.
COMMANDS FOR MOVING:
beginning-of-line (C-a)
Move to the start of the current line.
end-of-line (C-e)
Move to the end of the line.
forward-char (C-f)
Move forward a character.
backward-char (C-b)
Move back a character.
forward-word (M-f)
Move forward to the end of the next word.
backward-word (M-b)
Move back to the start of this, or the previous, word.
clear-screen (C-l)
Clear the screen leaving the current line at the top of the screen.
COMMANDS FOR MANIPULATING THE HISTORY:
accept-li